@extends('Admin.Layout.main')
@section('privateheader')
    <!-- DataTables -->
    <link rel="stylesheet" href="{{__BASE__}}/admin/plugins/datatables/dataTables.bootstrap.css">
@endsection
@section('content')
    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header">
                        @if($data['flag'] == 3)
                            {{--<h3 class="box-title" style="float: left;"> 列表--}}
                                {{--<a class="btn bg-red" href="/admini/member/rb">回收站</a>--}}
                                {{--<a class="btn bg-blue" href="/admini/member/buy_list/1">消费列表</a>--}}
                                {{--<a class="btn bg-blue" href="/admini/member/recharge_list/1">充值列表</a>--}}
                            {{--</h3>--}}
                        @elseif($data['flag'] == 4)
                            <h3 class="box-title" style="float: left;">列表回收站
                                <a class="btn bg-olive" href="{{__BASE__}}/admini/member">列表</a>
                            </h3>
                        @endif
                    </div>
                    <div class="box-header">
                        <form class="navbar-form navbar-left" role="search">
                            <div class="form-group">
                                支付状态&nbsp;
                                <select name="status" class="form-control">
                                    <option value="0" @if(key_exists('status',$data['search']) && $data['search']['status']==0) selected="selected" @endif>全部</option>
                                    <option value="1" @if(!empty($data['search']['status']) && $data['search']['status']==1) selected="selected" @endif>待支付</option>
                                    <option value="2" @if(!empty($data['search']['status']) && $data['search']['status']==2) selected="selected" @endif>已支付</option>
                                    <option value="3" @if(!empty($data['search']['status']) && $data['search']['status']==3) selected="selected" @endif>支付失败</option>
                                </select>
                                付款类型&nbsp;
                                <select name="type" class="form-control">
                                    <option value="0" @if(key_exists('type',$data['search']) && $data['search']['type']==0) selected="selected" @endif>全部</option>
                                    <option value="1" @if(!empty($data['search']['type']) && $data['search']['type']==1) selected="selected" @endif>申请检测199</option>
                                    <option value="2" @if(!empty($data['search']['type']) && $data['search']['type']==2) selected="selected" @endif>申请咨询200</option>
                                </select>
                                &nbsp;用户名
                                <input type="text" name="name" placeholder="输入用户名" class="form-control" value="{{@$data['search']['name']}}">
                            </div>
                            <button type="submit" class="btn btn-default">搜 索</button>
                        </form>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <table class="table table-bordered table-striped">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>订单号</th>
                                <th>用户名</th>
                                <th>订单类型</th>
                                <th>支付金额</th>
                                <th>推荐人</th>
                                <th>支付状态</th>
                                <th>下单时间</th>
                                <th>支付时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            @if(!empty($data['list']))
                                @foreach($data['list'] as $k => $v)
                                    <tr>
                                        <td>{{$v->id or ''}}</td>
                                        <td>{{$v->order_no or ''}}</td>
                                        <td>{{$v->name or ''}}</td>
                                        <td>
                                            <?php
                                                if($v->type == 1)
                                                {
                                                    echo '申请测试199支付';
                                                }else if($v->type == 2)
                                                {
                                                    echo '申请咨询200支付';
                                                }
                                            ?>
                                        </td>
                                        <td><?php echo !empty($v->paymoney) ? $v->paymoney/100 : ''; ?></td>
                                        <td>{{$v->pidname or ''}}</td>
                                        <td>
                                            <?php
                                                if($v->status == 1)
                                                {
                                                    echo '待支付';
                                                }else if($v->status == 2)
                                                {
                                                    echo '支付成功';
                                                }else if($v->status == 3)
                                                {
                                                    echo '支付失败';
                                                }
                                            ?>
                                        </td>
                                        <td><?php echo !empty($v->create_time) ? date('Y-m-d H:i:s',$v->create_time) : ''; ?></td>
                                        <td><?php echo !empty($v->pay_time) ? date('Y-m-d H:i:s',$v->pay_time) : ''; ?></td>
                                    </tr>
                                @endforeach
                            @endif
                            </tbody>
                        </table>
                        @if($data['list'])
                            <?php
                                $status = !empty($_GET['status']) ? $_GET['status'] : '';
                                $name = !empty($_GET['name']) ? $_GET['name'] : '';
                            ?>
                            {!! $data['list']->appends(['status'=>$status])->appends(['name'=>$name])->render() !!}
                        @endif
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </section>
@endsection
@section('privatefooter')
    <!-- DataTables -->
    <script src="{{__BASE__}}/admin/plugins/datatables/jquery.dataTables.min.js"></script>
    <script src="{{__BASE__}}/admin/plugins/datatables/dataTables.bootstrap.min.js"></script>
    <!-- page script -->
@endsection